package com.forgotpass;

import java.util.HashMap;

import com.commonfunction.CommFunction;
import com.databasefunction.AllDBFunction;
import com.login.LoginFunctions;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class Usernamesubmit extends ActionSupport{
	private String username;
	private HashMap dataMap = new HashMap();
	
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		CommFunction commFunction = new CommFunction();
		AllDBFunction allDBFunction = new AllDBFunction();
		dataMap.put("username", username);
		dataMap.put("questiondata", allDBFunction.securitytype(username));
		
		ActionContext.getContext().getSession().put("datamap", dataMap);
		return "success";
	}
	
	@Override
	public void validate() {
		// TODO Auto-generated method stub
		LoginFunctions loginFunctions = new LoginFunctions();
		AllDBFunction allDBFunction = new AllDBFunction();
		if(!allDBFunction.isuserexist(username)){
			addActionError("UserId not present");
		}
	}
}
